/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * areariservata_fine.java
 *
 * Created on 23-jul-2010, 12.29.46
 */

package mymall.views;
import mymall.custom.*;

/**
 *
 * @author Fabio Franchi
 */
public class areariservata_fine extends javax.swing.JPanel {

    private Boolean flagHelp = false;
    private index pagePanel;
    String txt = "Premi ? per accedere alla\n" +
                 "guida del centro MyMall";
    String txtHome = "Area riservata del centro MyMall\n" +
                     "Segui la procedura per inserire una nuova offerta del centro!";
    
    /** Creates new form home */
    public areariservata_fine(index PanP) {
        pagePanel = PanP;
        initComponents();
        helpText.setText(txt);
        titleSet.setText(pagePanel.getTitles());
        descriptionSet.setText(pagePanel.getDescription());
        fromSet.setText(pagePanel.getFrom());
        toSet.setText(pagePanel.getTo());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        header = new javax.swing.JPanel();
        nav = new javax.swing.JPanel();
        homeBtn = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        informazioniBtn = new javax.swing.JButton();
        headerImage = new javax.swing.JLabel();
        sx = new javax.swing.JPanel();
        inizioLbl = new javax.swing.JLabel();
        sxImage = new javax.swing.JLabel();
        main = new javax.swing.JPanel();
        riepilogoLbl = new javax.swing.JLabel();
        nextBtn = new javax.swing.JButton();
        titoloLbl = new javax.swing.JLabel();
        descrizioneLbl = new javax.swing.JLabel();
        dalLbl = new javax.swing.JLabel();
        alLbl = new javax.swing.JLabel();
        titleSet = new javax.swing.JTextField();
        descriptionPnl = new javax.swing.JScrollPane();
        descriptionSet = new javax.swing.JTextArea();
        fromSet = new javax.swing.JTextField();
        toSet = new javax.swing.JTextField();
        hintLbl = new javax.swing.JLabel();
        mainImage = new javax.swing.JLabel();
        footer = new javax.swing.JPanel();
        helpBtn = new javax.swing.JButton();
        help = new javax.swing.JPanel();
        helpText = new javax.swing.JTextArea();
        backBtn = new javax.swing.JButton();
        footerImage = new javax.swing.JLabel();

        setBackground(new java.awt.Color(255, 255, 255));
        setLayout(null);

        header.setBackground(new java.awt.Color(255, 255, 255));
        header.setPreferredSize(new java.awt.Dimension(1024, 211));
        header.setLayout(null);

        nav.setBackground(new java.awt.Color(192, 214, 233));
        nav.setLayout(null);

        homeBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/nav/home.png"))); // NOI18N
        homeBtn.setBorderPainted(false);
        homeBtn.setLocation(new java.awt.Point(20, 0));
        homeBtn.setMaximumSize(new java.awt.Dimension(34, 35));
        homeBtn.setMinimumSize(new java.awt.Dimension(34, 35));
        homeBtn.setPreferredSize(new java.awt.Dimension(34, 35));
        homeBtn.setSize(new java.awt.Dimension(34, 35));
        homeBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                homeBtnActionPerformed(evt);
            }
        });
        nav.add(homeBtn);
        homeBtn.setBounds(20, 0, 34, 35);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/nav/arrow.png"))); // NOI18N
        jLabel1.setSize(new java.awt.Dimension(35, 35));
        nav.add(jLabel1);
        jLabel1.setBounds(70, 0, 35, 35);

        informazioniBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/nav/areariservata_hover.png"))); // NOI18N
        informazioniBtn.setMaximumSize(new java.awt.Dimension(129, 35));
        informazioniBtn.setMinimumSize(new java.awt.Dimension(129, 35));
        informazioniBtn.setPreferredSize(new java.awt.Dimension(129, 35));
        informazioniBtn.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/nav/areariservata_hover.png"))); // NOI18N
        informazioniBtn.setSize(new java.awt.Dimension(129, 35));
        informazioniBtn.setVerifyInputWhenFocusTarget(false);
        informazioniBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                informazioniBtnActionPerformed(evt);
            }
        });
        nav.add(informazioniBtn);
        informazioniBtn.setBounds(120, 0, 129, 35);

        header.add(nav);
        nav.setBounds(22, 160, 980, 35);

        headerImage.setBackground(new java.awt.Color(255, 255, 255));
        headerImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/header.png"))); // NOI18N
        headerImage.setAlignmentX(0.5F);
        header.add(headerImage);
        headerImage.setBounds(0, 0, 1024, 211);

        add(header);
        header.setBounds(0, 0, 1024, 211);

        sx.setBackground(new java.awt.Color(255, 255, 255));
        sx.setBounds(new java.awt.Rectangle(0, 211, 282, 471));
        sx.setPreferredSize(new java.awt.Dimension(282, 471));
        sx.setLayout(null);

        inizioLbl.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/details/fine.png"))); // NOI18N
        sx.add(inizioLbl);
        inizioLbl.setBounds(11, 10, 260, 450);

        sxImage.setBackground(new java.awt.Color(255, 255, 255));
        sxImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/sx.png"))); // NOI18N
        sxImage.setAlignmentX(0.5F);
        sx.add(sxImage);
        sxImage.setBounds(0, 0, 282, 471);

        add(sx);
        sx.setBounds(0, 211, 282, 471);

        main.setBackground(new java.awt.Color(255, 255, 255));
        main.setBounds(new java.awt.Rectangle(282, 211, 742, 471));
        main.setPreferredSize(new java.awt.Dimension(742, 471));
        main.setLayout(null);

        riepilogoLbl.setFont(new java.awt.Font("Georgia", 1, 24));
        riepilogoLbl.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        riepilogoLbl.setText("RIEPILOGO");
        main.add(riepilogoLbl);
        riepilogoLbl.setBounds(250, 40, 280, 40);

        nextBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/buttons/next_salva.png"))); // NOI18N
        nextBtn.setBorderPainted(false);
        nextBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nextBtnActionPerformed(evt);
            }
        });
        main.add(nextBtn);
        nextBtn.setBounds(565, 205, 140, 60);

        titoloLbl.setFont(new java.awt.Font("Georgia", 1, 14));
        titoloLbl.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        titoloLbl.setText("Titolo:");
        main.add(titoloLbl);
        titoloLbl.setBounds(120, 100, 100, 30);

        descrizioneLbl.setFont(new java.awt.Font("Georgia", 1, 14));
        descrizioneLbl.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        descrizioneLbl.setText("Descrizione:");
        main.add(descrizioneLbl);
        descrizioneLbl.setBounds(120, 140, 100, 30);

        dalLbl.setFont(new java.awt.Font("Georgia", 1, 14));
        dalLbl.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        dalLbl.setText("Inizio validità offerta:");
        main.add(dalLbl);
        dalLbl.setBounds(50, 320, 170, 30);

        alLbl.setFont(new java.awt.Font("Georgia", 1, 14));
        alLbl.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        alLbl.setText("Fine validità offerta:");
        main.add(alLbl);
        alLbl.setBounds(60, 360, 160, 30);

        titleSet.setBackground(new java.awt.Color(240, 240, 240));
        titleSet.setEditable(false);
        titleSet.setFont(new java.awt.Font("Georgia", 0, 14)); // NOI18N
        main.add(titleSet);
        titleSet.setBounds(240, 100, 300, 28);

        descriptionSet.setBackground(new java.awt.Color(240, 240, 240));
        descriptionSet.setColumns(20);
        descriptionSet.setEditable(false);
        descriptionSet.setFont(new java.awt.Font("Georgia", 0, 14)); // NOI18N
        descriptionSet.setRows(5);
        descriptionPnl.setViewportView(descriptionSet);

        main.add(descriptionPnl);
        descriptionPnl.setBounds(240, 150, 300, 150);

        fromSet.setBackground(new java.awt.Color(240, 240, 240));
        fromSet.setEditable(false);
        fromSet.setFont(new java.awt.Font("Georgia", 0, 14)); // NOI18N
        main.add(fromSet);
        fromSet.setBounds(240, 320, 95, 28);

        toSet.setBackground(new java.awt.Color(240, 240, 240));
        toSet.setEditable(false);
        toSet.setFont(new java.awt.Font("Georgia", 0, 14)); // NOI18N
        main.add(toSet);
        toSet.setBounds(240, 360, 95, 28);

        hintLbl.setFont(new java.awt.Font("Georgia", 2, 12));
        hintLbl.setForeground(new java.awt.Color(100, 100, 100));
        hintLbl.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        hintLbl.setText("Verifica la correttezza dei dati e conferma per salvare");
        main.add(hintLbl);
        hintLbl.setBounds(240, 400, 300, 40);

        mainImage.setBackground(new java.awt.Color(255, 255, 255));
        mainImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/main.png"))); // NOI18N
        mainImage.setAlignmentX(0.5F);
        mainImage.setBounds(new java.awt.Rectangle(0, 0, 742, 471));
        main.add(mainImage);
        mainImage.setBounds(0, 0, 742, 471);

        add(main);
        main.setBounds(282, 211, 742, 471);

        footer.setBackground(new java.awt.Color(255, 255, 255));
        footer.setBounds(new java.awt.Rectangle(0, 682, 1024, 86));
        footer.setPreferredSize(new java.awt.Dimension(1024, 86));
        footer.setLayout(null);

        helpBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/buttons/help.png"))); // NOI18N
        helpBtn.setBorder(null);
        helpBtn.setBounds(new java.awt.Rectangle(21, 13, 60, 60));
        helpBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                helpBtnActionPerformed(evt);
            }
        });
        footer.add(helpBtn);
        helpBtn.setBounds(21, 13, 60, 60);

        help.setBackground(new java.awt.Color(255, 255, 255));
        help.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2));
        help.setPreferredSize(new java.awt.Dimension(600, 60));
        help.setLayout(null);

        helpText.setColumns(50);
        helpText.setEditable(false);
        helpText.setFont(new java.awt.Font("Georgia", 1, 15));
        helpText.setForeground(new java.awt.Color(55, 55, 55));
        helpText.setRows(1);
        helpText.setTabSize(6);
        helpText.setWrapStyleWord(true);
        helpText.setAutoscrolls(false);
        helpText.setBorder(null);
        helpText.setVerifyInputWhenFocusTarget(false);
        help.add(helpText);
        helpText.setBounds(45, 10, 240, 40);

        footer.add(help);
        help.setBounds(51, 13, 300, 60);

        backBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/buttons/back_new.png"))); // NOI18N
        backBtn.setBorderPainted(false);
        backBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backBtnActionPerformed(evt);
            }
        });
        footer.add(backBtn);
        backBtn.setBounds(763, 13, 240, 60);

        footerImage.setBackground(new java.awt.Color(255, 255, 255));
        footerImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mymall/img/footer.png"))); // NOI18N
        footerImage.setAlignmentX(0.5F);
        footerImage.setBounds(new java.awt.Rectangle(0, 0, 1024, 86));
        footer.add(footerImage);
        footerImage.setBounds(0, 0, 1024, 86);

        add(footer);
        footer.setBounds(0, 682, 1024, 86);
    }// </editor-fold>//GEN-END:initComponents

    private void helpBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helpBtnActionPerformed
        if (flagHelp == false){
            help.setSize(600,60);
            helpText.setSize(540,40);
            helpText.setText(txtHome);
            flagHelp = true;
            }
        else {
            help.setSize(300,60);
            helpText.setSize(240,40);
            helpText.setText(txt);
            flagHelp = false;
            }
    }//GEN-LAST:event_helpBtnActionPerformed

    private void homeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_homeBtnActionPerformed
        pagePanel.activeView("home");
    }//GEN-LAST:event_homeBtnActionPerformed

    private void backBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backBtnActionPerformed

        pagePanel.activeView("areariservata_periodo");
    }//GEN-LAST:event_backBtnActionPerformed

    private void informazioniBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_informazioniBtnActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_informazioniBtnActionPerformed

    private void nextBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextBtnActionPerformed
        save salva = new save(pagePanel);
        salva.setVisible(true);
        //Costruisco l'oggetto data per invocare il metodo add() che mi permette di aggiungere un nodo all'xml
        data dataobject = new data();

        dataobject.add(pagePanel.getTitles(), pagePanel.getDescription(), pagePanel.getFrom(), pagePanel.getTo());

        pagePanel.activeView("home");
    }//GEN-LAST:event_nextBtnActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel alLbl;
    private javax.swing.JButton backBtn;
    private javax.swing.JLabel dalLbl;
    private javax.swing.JScrollPane descriptionPnl;
    private javax.swing.JTextArea descriptionSet;
    private javax.swing.JLabel descrizioneLbl;
    private javax.swing.JPanel footer;
    private javax.swing.JLabel footerImage;
    private javax.swing.JTextField fromSet;
    private javax.swing.JPanel header;
    private javax.swing.JLabel headerImage;
    private javax.swing.JPanel help;
    private javax.swing.JButton helpBtn;
    private javax.swing.JTextArea helpText;
    private javax.swing.JLabel hintLbl;
    private javax.swing.JButton homeBtn;
    private javax.swing.JButton informazioniBtn;
    private javax.swing.JLabel inizioLbl;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel main;
    private javax.swing.JLabel mainImage;
    private javax.swing.JPanel nav;
    private javax.swing.JButton nextBtn;
    private javax.swing.JLabel riepilogoLbl;
    private javax.swing.JPanel sx;
    private javax.swing.JLabel sxImage;
    private javax.swing.JTextField titleSet;
    private javax.swing.JLabel titoloLbl;
    private javax.swing.JTextField toSet;
    // End of variables declaration//GEN-END:variables

}
